AppTitle "Six pence","Merry crimbo every one!" Graphics 600,600,32,2 SetBuffer BackBuffer() instructions() SeedRnd MilliSecs() Type particle Field x#,y# Field angle# Field red,green,blue End Type Global x=100 Global y=320 Global x1=490 Global y1=320 Global xx1=-1 Global yy1=-1 Global ax1=290 Global ay1=520 Global axx1=-1 Global ayy1=-1 Global pudding Global penny Global px=Rnd(250)+175 Global py=Rnd(300)+175 drawpudding() drawpenny() While Not KeyDown(1) Cls DrawImage penny,px,py DrawImage pudding,100,100 SetBuffer ImageBuffer(pudding) Color 0,0,0 Rect x-100,y-100,10,10 Rect x1-100,y1-100,10,10 Rect ax1-100,ay1-100,10,10 SetBuffer BackBuffer() If RectsOverlap(x,y,10,10,px,py,10,10) Then boom foundpenny EndIf If RectsOverlap(x,y,10,10,x1,y1,10,10) Then x=100 y=100 EndIf Color 255,255,255 Text x,y,"X" If KeyDown(205) And x<500 Then x=x+2 If KeyDown(203) And x>100 Then x=x-2 If KeyDown(200) And y>120 Then y=y-2 If KeyDown(208) And y<520 Then y=y+2 mouse1() mouse2() player1wins() player2wins() Flip Wend End ;mouse1 Function mouse1() Color 255,255,0 Text x1,y1,"X" x1=x1+xx1 y1=y1+yy1 If Int(Rnd(300))=5 Then xx1=Rnd(2) If x1<=100 Then xx1=1 If x1>=490 Then xx1=-1 If y1<=120 Then yy1=1 If y1>=520 Then yy1=-1 End Function ;mouse2 Function mouse2() Color 0,255,0 Text ax1,ay1,"X" ax1=ax1+axx1 ay1=ay1+ayy1 If Int(Rnd(200))=5 Then axx1=Rnd(2) If ax1<=100 Then axx1=1 If ax1>=490 Then axx1=-1 If ay1<=120 Then ayy1=1 If ay1>=520 Then ayy1=-1 End Function ; christmas pud Function drawpudding() Color 255,255,255 Oval 100,100,400,400 icing=CreateImage(400,100) GrabImage icing,100,100 Cls Color 128,54,0 Oval 100,100,400,400 DrawImage icing,100,100 Color 255,255,255 Oval 128,170,75,75 Oval 200,170,75,75 Oval 272,170,75,75 Oval 340,170,75,75 Oval 397,170,75,75 Color 255,0,0 Oval 290,80,20,20 Oval 305,90,20,20 Color 0,255,0 For f=280 To 305 Line 305,100,f,120 Next For f=85 To 95 Line 300,100,270,f Next FreeImage icing pudding=CreateImage(400,450) GrabImage pudding,100,70 Cls End Function ; draw penny Function drawpenny() penny=CreateImage(10,10) Color 255,255,0 Oval 10,10,10,10 GrabImage penny,10,10 End Function Function boom() For f=1 To 30 part.particle = New particle part\x#=x part\y#=y part\angle#=Rnd(360) part\red=Rnd(255) part\green=Rnd(255) part\blue=Rnd(255) Next End Function Function updateboom() For part.particle = Each particle part\x#=part\x# + Cos(part\angle#)*4 part\y#=part\y# + Sin(part\angle#)*4 Color (part\red),(part\green),(part\blue) Rect part\x#,part\y#,4,4 If part\x# > 800 Or part\x#<0 Or part\y#>600 Or part\y#<0 Then Delete part Next End Function Function foundpenny() timer = MilliSecs() .wait2secs updateboom() Color 255,255,0 Oval x-10,y-10,20,20 Flip If timer+1500 > MilliSecs() Then Goto wait2secs For f=0 To 100 Color Rnd(255),Rnd(255),Rnd(255) Text Rnd(500),Rnd(600),"MERRY CHRISTMAS" Flip Next FlushKeys Cls Color 255,255,255 Text 220,300,"You found the six pence !" Flip WaitKey End End Function Function player1wins() If RectsOverlap(x1,y1,10,10,px,py,10,10) Then Color 255,255,0 Oval px,py,10,10 Flip Delay 500 Oval px-25,py-25,60,60 Flip Delay 500 Oval px-50,py-50,110,110 Flip Delay 500 Oval px-75,py-75,160,160 Flip Delay 500 Oval px-100,py-100,210,210 Color 0,0,0 Text px-30,py,"Six Pence" Color 255,255,0 Flip Delay 500 Color 0,0,0 For f=0 To 600 Step 10 Rect 0,f,600,10 Flip Next Color 255,255,255 Text 260,300,"You lose" FlushKeys Flip WaitKey End EndIf End Function Function player2wins() If RectsOverlap(ax1,ay1,10,10,px,py,10,10) Then Color 255,255,0 Oval px,py,10,10 Flip Delay 500 Oval px-25,py-25,60,60 Flip Delay 500 Oval px-50,py-50,110,110 Flip Delay 500 Oval px-75,py-75,160,160 Flip Delay 500 Oval px-100,py-100,210,210 Color 0,0,0 Text px-30,py,"Six Pence" Color 255,255,0 Flip Delay 500 Color 0,0,0 For f=0 To 600 Step 10 Rect 0,f,600,10 Flip Next Color 255,255,255 Text 260,300,"You lose" FlushKeys Flip WaitKey End EndIf End Function Function instructions() Color 255,255,255 Cls Text 10,50,"FIND THE SIXPENCE" Color 255,255,0 Oval 160,50,10,10 Color 255,255,255 Text 10,100,"It's dinner, Christmas day, and the grown ups have left the table." Text 10,115,"As usual, they're unable to finish off the Christmas pudding," Text 10,130,"having gorged themselves on too many brussel sprouts." Text 10,160,"Wishing to join in the festivities, the resident house mice 'X' decide" Text 10,175,"to embark on their own little party game." Text 10,190,"Knowing there's a sixpence hidden somewhere in the pudding, they have" Text 10,205,"a competition to see who can eat the pudding away to find it first." Text 10,235,"You start on the left of the pudding and can move yourself around using" Text 10,250,"(just for a change) the cursor keys. Be careful of one of the mice, as" Text 10,265,"coming into contact with it will bounce you off the pudding to the side" Text 10,280,"of the screen." Text 10,310,"Press any key to start" Text 80,580,"........Programmed in SINCLAIRSPECTRUMOVISION........" FlushKeys Flip WaitKey FlushKeys Text 10,340,"....except that one." Flip WaitKey Cls End Function